﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VkontakteChecker.Logic;

namespace VkontakteChecker
{
    /// <summary>
    /// Interaction logic for SettingsWindow.xaml
    /// </summary>
    public partial class SettingsWindow : Window
    {
        public SettingsWindow()
        {
            InitializeComponent();
            if(Settings.Email != null && Settings.Password != null)
            {
                EmailField.Text = Settings.Email;
                PassField.Password = Settings.Password;
                TimeField.Text = Settings.Period.ToString();
            }
        }

        private void Button2Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void Button1Click(object sender, RoutedEventArgs e)
        {
            Settings.Email = EmailField.Text;
            Settings.Password = PassField.Password;
            Settings.Period = int.Parse(TimeField.Text);
            Close();
            Actions.InitializeUser();
            
        }
    }
}
